# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-docx2txt
pkgname=('python2-docx2txt' 'python-docx2txt')
_pkgname=docx2txt
pkgver=0.9
pkgrel=1
pkgdesc='A pure python-based utility to extract text from docx files.'
arch=('any')
url='https://pypi.org/project/docx2txt/'
license=('custom:unknown')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/docx2txt-0.9.tar.gz")
sha512sums=('6075fe5ce6b9dd9ad202f024656cac8be732d4326b7fbbefc2d77a3a0918d21b736a4fa43ab1b502c5a808f7fcd9d0f03381fda3acd39f4ecf68fc5c7a878c3c')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-docx2txt() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/${_pkgname}2"
}

package_python-docx2txt() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

